<template>
  <div class="coach-edit">
    <el-row :gutter="10">
      <el-col :span="5">
        <el-card class="box-card">
          <div slot="header" class="clearfix">
            <span>头像</span>
          </div>
          <div class="avtar-wrap">
            <div class="avtar-item">
              <p><span>形象照</span></p>
              <el-upload
                class="avatar-uploader"
                action=""
                accept=".png,.jpg,.jpeg"
                :show-file-list="false"
                ref='cvue-upload'
                :headers="accessToken"
                :on-preview="handlePictureCardPreview"
                :multiple="false"
                :http-request="uploadFile"
                :auto-upload="true"
                :file-list="fileList"
                :on-remove="handleRemove">
                <ul class="list-upload-image" v-if="portraitPictureFile">
                  <li>
                    <img :src="portraitPictureFile" class="image-item">
                    <i class="el-icon-close icon-close" @click.prevent.stop="deletePortrait"></i>
                  </li>
                </ul>    
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                <div slot="tip" class="el-upload__tip">支持png/jpg，建议尺寸200*200px，大小不超过2M</div>
              </el-upload>
            </div>
            <div class="avtar-item">
              <p><span>人脸识别照片</span></p>
              <el-upload
                class="avatar-uploader"
                action=""
                accept=".png,.jpg,.jpeg"
                :show-file-list="false"
                ref='cvue-upload1'
                :headers="accessToken"
                :on-preview="handlePictureCardPreview"
                :multiple="false"
                :http-request="uploadFile1"
                :auto-upload="true"
                :file-list="fileList1"
                :on-remove="handleRemove">
                <ul class="list-upload-image" v-if="faceImageFile">
                  <li>
                    <img :src="faceImageFile" class="image-item">
                    <i class="el-icon-close icon-close" @click.prevent.stop="deleteFaceImage"></i>
                  </li>
                </ul>    
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                <div slot="tip" class="el-upload__tip">支持png/jpg，建议尺寸200*200px，大小不超过2M</div>
              </el-upload>
              <p class="avtar-tip">规格说明</p>
            </div>
          </div>
        </el-card>
      </el-col>
      <el-col :span="19">
        <el-form
          :model="ruleForm"
          :rules="rules"
          ref="ruleForm"
          label-width="100px"
          class="demo-ruleForm">
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <span>基础信息</span>
            </div>
            <el-row :gutter="20">
              <el-col :span="8">
                <el-form-item label="手机号" prop="phone">
                  <el-input v-model="ruleForm.phone" :disabled="disabled"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="8">
                <el-form-item label="姓名" prop="userName">
                  <el-input v-model.trim="ruleForm.userName" :disabled="disabled"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="8">
                <el-form-item label="性别" prop="gender">
                  <el-radio-group v-model="ruleForm.gender">
                    <el-radio :label="item.dicCode" v-for="(item, index) in genderArr" :key="index">{{ item.dicName }}</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="8">
                <el-form-item label="归属店铺" prop="storeId">
                  <el-select v-model="ruleForm.storeId" placeholder="请选择" style="width:100%" clearable>
                    <el-option
                      v-for="item in storeArr"
                      :key="item.id"
                      :label="item.storeName"
                      :value="item.id">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="会员端" prop="enableShow">
                  <el-radio-group v-model="ruleForm.enableShow">
                    <el-radio :label="item.dicCode" v-for="(item, index) in enableShowArr" :key="index">{{ item.dicName }}</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="8">
                <el-form-item label="权限角色" prop="roleCode">
                  <el-select v-model="ruleForm.roleCode" placeholder="请选择" style="width:100%" clearable>
                    <el-option
                      v-for="item in roleArr"
                      :key="item.dicCode"
                      :label="item.dicName"
                      :value="item.dicCode">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="8">
                <el-form-item label="状态" prop="enabled">
                  <el-radio-group v-model="ruleForm.enabled">
                    <el-radio :label="item.dicCode" v-for="(item, index) in enabledArr" :key="index">{{ item.dicName }}</el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>
          </el-card>
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <span>详细资料</span>
            </div>
            <el-row :gutter="20">
              <el-col :span="8">
                <el-form-item label="身高" prop="stature">
                  <el-input v-model.trim="ruleForm.stature" :disabled="disabled">
                    <template slot="append">cm</template>
                  </el-input>
                </el-form-item>
              </el-col>
              <el-col :span="8">
                <el-form-item label="体重" prop="weight">
                  <el-input v-model.trim="ruleForm.weight" :disabled="disabled">
                    <template slot="append">kg</template>
                  </el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="8">
                <el-form-item label="教练等级" prop="starLevel">
                  <el-rate v-model="ruleForm.starLevel"></el-rate>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="16">
                <el-form-item label="简介" prop="introduce">
                  <el-input v-model.trim="ruleForm.introduce" :disabled="disabled" type="textarea" :rows="10"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="24">
                <el-form-item label="个人风采" prop="coachMienFileIds">
                  <el-upload
                    class="avatar-uploader"
                    action=""
                    :show-file-list="false"
                    ref='cvue-upload2'
                    :headers="accessToken"
                    :on-preview="handlePictureCardPreview"
                    :multiple="false"
                    :limit="10"
                    accept=".png,.jpg,.jpeg"
                    :http-request="uploadFile2"
                    :auto-upload="true"
                    :file-list="fileList2"
                    :on-remove="handleRemove">
                    <ul v-if="ruleForm.coachMienFile.length >= 0" class="list-upload-image fix-upload">
                      <li><i class="el-icon-plus avatar-uploader-icon"></i></li>
                      <li v-for="(item,index) in ruleForm.coachMienFile" :key="index">
                        <img :src="item" class="image-item">
                        <i class="el-icon-close icon-close" @click.prevent.stop="deleteImage(index, ruleForm.coachMienFile, ruleForm.coachMienFileIds)"></i>
                      </li>
                    </ul>
                  </el-upload>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="教练证书" prop="coachCertificateFileIds">
                  <el-upload
                    class="avatar-uploader"
                    action=""
                    :show-file-list="false"
                    ref='cvue-upload3'
                    :headers="accessToken"
                    :on-preview="handlePictureCardPreview"
                    :multiple="false"
                    :limit="10"
                    accept=".png,.jpg,.jpeg"
                    :http-request="uploadFile3"
                    :auto-upload="true"
                    :file-list="fileList3"
                    :on-remove="handleRemove">
                    <ul v-if="ruleForm.coachCertificateFile.length >= 0" class="list-upload-image fix-upload">
                      <li><i class="el-icon-plus avatar-uploader-icon"></i></li>
                      <li v-for="(item,index) in ruleForm.coachCertificateFile" :key="index">
                        <img :src="item" class="image-item">
                        <i class="el-icon-close icon-close" @click.prevent.stop="deleteImage(index, ruleForm.coachCertificateFile, ruleForm.coachCertificateFileIds)"></i>
                      </li>
                    </ul>
                  </el-upload>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="授课案例" prop="teachCaseFileIds">
                  <el-upload
                    class="avatar-uploader"
                    action=""
                    :show-file-list="false"
                    ref='cvue-upload4'
                    :headers="accessToken"
                    :on-preview="handlePictureCardPreview"
                    :multiple="false"
                    :limit="10"
                    accept=".png,.jpg,.jpeg"
                    :http-request="uploadFile4"
                    :auto-upload="true"
                    :file-list="fileList4"
                    :on-remove="handleRemove">
                    <ul v-if="ruleForm.teachCaseFile.length >= 0" class="list-upload-image fix-upload">
                      <li><i class="el-icon-plus avatar-uploader-icon"></i></li>
                      <li v-for="(item,index) in ruleForm.teachCaseFile" :key="index">
                        <img :src="item" class="image-item">
                        <i class="el-icon-close icon-close" @click.prevent.stop="deleteImage(index, ruleForm.teachCaseFile, ruleForm.teachCaseFileIds)"></i>
                      </li>
                    </ul>
                  </el-upload>
                </el-form-item>
              </el-col>
            </el-row>
          </el-card>
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <span>教授课程</span>
            </div>
            <el-row :gutter="20">
              <el-col :span="24">
                <el-form-item label="选择课程" prop="introduce">
                  <div class="avatar-uploader" style="display: flex;">
                    <ul v-if="selectCourseData.length > 0" class="list-upload-image">
                      <li v-for="(item, index) in selectCourseData" :key="index">
                        <img :src="item.frontImageFileUrl" class="image-item">
                        <i class="el-icon-close icon-close" @click.prevent.stop="deleteImage(index, selectCourseData, [])"></i>
                        <span :class="selectCourseData[index].courseState == 1 ? 'course-state1':'course-state2'">{{ selectCourseData[index].courseState === 1  ? '上架' : '下架' }}</span>
                        <span class="course-name">{{ selectCourseData[index].courseName }}</span>
                      </li>
                    </ul>
                    <i class="el-icon-plus avatar-uploader-icon" @click="handleEdit"></i>
                  </div>
                </el-form-item>
              </el-col>
            </el-row>
          </el-card>
        </el-form>
      </el-col>
    </el-row>
    <div class="edit-footer">
      <el-button @click="confirmDialog" type="primary">保存</el-button>
      <el-button @click="closeDialog">取消</el-button>
    </div>
    <coach-course-edit
      @closeSecDialog="closeSecDialog('edit')"
      @confirmSecDialog="confirmSecDialog('edit')"
      @handleSecClose="closeSecDialog('edit')"
      v-if="dialogCoachCourseEdit"
      :dialogVisible="dialogCoachCourseEdit">
    </coach-course-edit>
  </div>
</template>

<script>
/* eslint-disable */
import {mapGetters} from 'vuex'
import cvueTable from '@/components/cvue-table'
import { validPhone } from '@/util/validator.js'
import coachCourseEdit from './coachCourseEdit'
import BMF from 'browser-md5-file'
const bmf = new BMF()
var validInt = (rule, value, callback) => {
  const reg = /^[1-9]\d*$/
  if (!reg.test(value) && value) {
    callback(new Error('请输入正整数'))
  } else {
    callback()
  }
}
export default {
  name: 'coach-edit',
  components: {
    cvueTable,
    coachCourseEdit
  },
  data () {
    return {
      src: 'https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg',
      ruleForm: {
        phone: '',
        userName: '',
        gender: 1,
        storeId: '',
        enableShow: 1,
        roleCode: '',
        enabled: 1,
        stature: '',
        weight: '',
        starLevel: 1,
        introduce: '',
        coachMienFileIds: [],
        coachMienFile: [],
        coachCertificateFileIds: [],
        coachCertificateFile: [],
        teachCaseFileIds: [],
        teachCaseFile: []
      },
      portraitPictureFileId: '',
      portraitPictureFile: '',
      faceImageFileId: '',
      faceImageFile: '',
      rules: {
        userName: [
          { required: true, message: '请输入姓名', trigger: 'blur' },
          { min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur' }
        ],
        introduce: [
          { min: 0, max: 500, message: '长度在 0 到 500 个字符', trigger: 'blur' }
        ],
        phone: [
          { required: true, message: '请输入手机号码', trigger: 'blur' },
          { validator: validPhone, trigger: 'blur' }
        ],
        stature: [
          { validator: validInt, trigger: 'blur' }
        ],
        weight: [
          { validator: validInt, trigger: 'blur' }
        ]
      },
      disabled: false,
      fileList: [],
      fileList1: [],
      fileList2: [],
      fileList3: [],
      fileList4: [],
      storeArr: [],
      dialogCoachCourseEdit: false,
      selectCourseData: [],
      genderArr: [],
      enableShowArr: [],
      enabledArr: [],
      roleArr: [],
      coachId: '',
      courseData: []
    }
  },
  beforeRouteLeave (to, from, next) {
    // if (this.$route.query.action == 'edit') {
    //   this.$confirm('确定要离开编辑页面吗?', '提示', {
    //     confirmButtonText: '确定',
    //     cancelButtonText: '取消',
    //     type: 'warning'
    //   }).then(() => {
    //     next()
    //   }).catch(() => {   
    //     location.reload()      
    //   })
    // } else {
    //   next()
    // }
    next()
  },
  computed: {
    ...mapGetters(['token', 'userInfo', 'tagCurrent']),
    accessToken () {
      var accessToken = {
        'Authorization': this.token
      }
      return accessToken
    }
  },
  created () {
    this.getDic().then(res=>{
      // console.log(res)
      this.dict = res.data
      this.dict.forEach((item, index) => {
        if (item.dicName == 'Gender') {
          this.genderArr = item.dicValueList
        }
        if (item.dicName == 'EnableShow') {
          this.enableShowArr = item.dicValueList
        }
        if (item.dicName == 'Enabled') {
          this.enabledArr = item.dicValueList
        }
        if (item.dicName == 'Role') {
          this.roleArr = item.dicValueList
        }
      })
    })
  },
  mounted () {
    if (this.$route.query.action == 'edit') {
      this.getCourseList()
    }
    this.getShopList()
  },
  methods: {
    deletePortrait () {
      this.portraitPictureFileId = ''
      this.portraitPictureFile = ''
    },
    deleteFaceImage () {
      this.faceImageFileId = ''
      this.faceImageFile = ''
    },
    // 列表接口
    getShopList () {
      var params = {
        // page: this.tablePage,
        // limit: this.page.pageSize,
        // name: name
      }
      this.$store.dispatch('manage/StoreGet', params).then(res => {
        // console.log(res)
        var data = res.data
        this.storeArr = data
      }).catch(err => {
        console.log(err)
      })
    },
    // 自定义文件上传
    uploadFile (param) { 
      var fileObj = param.file
      bmf.md5(fileObj, (err, md5) => {
        console.log(err,1)
        var formData = new FormData()
        formData.append('file', fileObj)    
        formData.append('explorerId', -1)
        formData.append('md5', md5)
        formData.append('name', fileObj.name)
        formData.append('parentId', -1)
        this.$store.dispatch('fileFun/UploadFile', formData).then(res => {
          if(res.code == '200'){
            this.portraitPictureFileId = res.data.fileId
            this.getPic(this.portraitPictureFileId).then(response => {
              this.portraitPictureFile = response.data
            })
          }
        })
      })
    },
    uploadFile1 (param) { 
      var fileObj = param.file
      bmf.md5(fileObj, (err, md5) => {
        console.log(err,1)
        var formData = new FormData()
        formData.append('file', fileObj)    
        formData.append('explorerId', -1)
        formData.append('md5', md5)
        formData.append('name', fileObj.name)
        formData.append('parentId', -1)
        this.$store.dispatch('fileFun/UploadFile', formData).then(res => {
          if(res.code == '200'){
            this.faceImageFileId = res.data.fileId
            this.getPic(this.faceImageFileId).then(response => {
              this.faceImageFile = response.data
            })
          }
        })
      })
    },
    // 自定义文件上传
    uploadFile2 (param) { 
      var fileObj = param.file
      bmf.md5(fileObj, (err, md5) => {
        console.log(err,1)
        var formData = new FormData()
        formData.append('file', fileObj)
        formData.append('explorerId', -1)
        formData.append('md5', md5)
        formData.append('name', fileObj.name)
        formData.append('parentId', -1)
        this.$store.dispatch('fileFun/UploadFile', formData).then(res => {
          if(res.code == '200'){
            this.ruleForm.coachMienFileIds.push(res.data.fileId)
            this.getPic(res.data.fileId).then(response => {
              this.ruleForm.coachMienFile.push(response.data)
            })
          }
        })
      })
    },
    uploadFile3 (param) { 
      var fileObj = param.file
      bmf.md5(fileObj, (err, md5) => {
        console.log(err,1)
        var formData = new FormData()
        formData.append('file', fileObj)
        formData.append('explorerId', -1)
        formData.append('md5', md5)
        formData.append('name', fileObj.name)
        formData.append('parentId', -1)
        this.$store.dispatch('fileFun/UploadFile', formData).then(res => {
          if(res.code == '200'){
            this.ruleForm.coachCertificateFileIds.push(res.data.fileId)
            this.getPic(res.data.fileId).then(response => {
              this.ruleForm.coachCertificateFile.push(response.data)
            })
          }
        })
      })
    },
    uploadFile4 (param) { 
      var fileObj = param.file
      bmf.md5(fileObj, (err, md5) => {
        console.log(err,1)
        var formData = new FormData()
        formData.append('file', fileObj)
        formData.append('explorerId', -1)
        formData.append('md5', md5)
        formData.append('name', fileObj.name)
        formData.append('parentId', -1)
        this.$store.dispatch('fileFun/UploadFile', formData).then(res => {
          if(res.code == '200'){
            this.ruleForm.teachCaseFileIds.push(res.data.fileId)
            this.getPic(res.data.fileId).then(response => {
              this.ruleForm.teachCaseFile.push(response.data)
            })
          }
        })
      })
    },
    submitUpload () {
      this.$refs['cvue-upload'].submit()
    },
    handlePictureCardPreview () {},
    handleRemove (file, fileList) {
      console.log(file, fileList)
    },
    handleResetForm () {
      this.$refs['ruleForm'].resetFields()
    },
    getCoachDetail () {
      var params = {
        userId: this.$route.query.id
      }
      this.$store.dispatch('manage/CoachDetailGet', params).then(res => {
        // console.log(res)
        if (res.code == 200) {
          var data = res.data
          this.$set(this.ruleForm, 'phone', data.phone)
          this.$set(this.ruleForm, 'userName', data.userName)
          this.$set(this.ruleForm, 'gender', data.gender)
          this.$set(this.ruleForm, 'storeId', data.storeId)
          this.$set(this.ruleForm, 'enableShow', data.enableShow)
          this.$set(this.ruleForm, 'roleCode', data.roleCode)
          this.$set(this.ruleForm, 'enabled', data.enabled)
          this.$set(this.ruleForm, 'stature', data.stature)
          this.$set(this.ruleForm, 'weight', data.weight)
          this.$set(this.ruleForm, 'starLevel', data.starLevel)
          this.$set(this.ruleForm, 'introduce', data.introduce)
          this.portraitPictureFileId = data.portraitPictureFileId
          this.getPic(this.portraitPictureFileId).then(response => {
            this.portraitPictureFile = response.data
          })
          this.faceImageFileId = data.faceImageFileId
          this.getPic(this.faceImageFileId).then(response => {
            this.faceImageFile = response.data
          })
          this.getPicList(data.coachMienFileIds).then(res => {
            for (var key in res.data) {
              this.ruleForm.coachMienFile.push(res.data[key])
              this.ruleForm.coachMienFileIds.push(key)
            }
          })
          this.getPicList(data.coachCertificateFileIds).then(res => {
            for (var key in res.data) {
              this.ruleForm.coachCertificateFile.push(res.data[key])
              this.ruleForm.coachCertificateFileIds.push(key)
            }
          })
          this.getPicList(data.teachCaseFileIds).then(res => {
            for (var key in res.data) {
              this.ruleForm.teachCaseFile.push(res.data[key])
              this.ruleForm.teachCaseFileIds.push(key)
            }
          })
          var selectCourseData = []
          this.courseData.forEach((item, index) => {
            if (data.courseIds.indexOf(item.id) >= 0) {
              selectCourseData.push(item)
            }
          })
          this.selectCourseData = selectCourseData
          console.log(this.selectCourseData)
          this.coachId = data.userId
        }
      }).catch(err => {
        console.log(err)
      })
    },
    getCourseList () {
      var params = {
        current: 1,
        size: 1000,
        courseType: ''
      }
      this.$store.dispatch('manage/CourseGetList', params).then(res => {
        // console.log(res)
        if (res.code == '200') {
          var data = res.data.records
          this.courseData = data
          this.getCoachDetail()
        }
      })
    },
    getPic (fileId) {
      var paramsData = {
        fileId: fileId
      }
      return this.$store.dispatch('fileFun/GetPublicUrl', paramsData)
    },
    getPicList (fileIds) {
      return this.$store.dispatch('fileFun/ListPublicUrl', fileIds)
    },
    deleteImage (index, imageFiles, imageFileIds) {
      imageFiles.splice(index, 1)
      imageFileIds.splice(index, 1)
    },
    handleEdit () {
      this.dialogCoachCourseEdit = true
    },
    // 关闭弹窗
    closeSecDialog (params) {
      if (params == 'edit') {
        this.dialogCoachCourseEdit = false
      }
    },
    // 确认
    confirmSecDialog (params) {
      if (params == 'edit') {
        this.dialogCoachCourseEdit = false
      }
    },
    // 关闭弹窗
    closeDialog () {
      this.closeTagTo('/home/coach')
    },
    // 确认
    confirmDialog () {
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          var courseIds = []
          this.selectCourseData.forEach((item, index) => {
            courseIds.push(item.id)
          })
          var params = {
            "userId": this.$route.query.action == 'add' ? '' : this.coachId,
            "coachCertificateFileIds": this.ruleForm.coachCertificateFileIds,
            "coachMienFileIds": this.ruleForm.coachMienFileIds,
            "courseIds": courseIds,
            "enableShow": this.ruleForm.enableShow,
            "enabled": this.ruleForm.enabled,
            "faceImageFileId": this.faceImageFileId,
            "gender": this.ruleForm.gender,
            "introduce": this.ruleForm.introduce,
            "phone": this.ruleForm.phone,
            "portraitPictureFileId": this.portraitPictureFileId,
            "roleCode": this.ruleForm.roleCode,
            "starLevel": this.ruleForm.starLevel,
            "stature": this.ruleForm.stature,
            "storeId": this.ruleForm.storeId,
            "teachCaseFileIds": this.ruleForm.teachCaseFileIds,
            "userName": this.ruleForm.userName,
            "weight": this.ruleForm.weight
          }
          // console.log(params)
          this.dialogLoading = true
          var url = this.$route.query.action == 'add' ? 'manage/CoachAdd' : 'manage/CoachEdit'
          this.$store.dispatch(url, params).then(res => {
            // console.log(res)
            if(res.code == '200'){
              this.$message({
                message: res.msg,
                duration: 2000,
                type: 'success'
              })
              // this.$emit('confirmDialog')
              this.closeTagTo('/home/coach')
            }else{
              this.$message({ message: res.msg, duration: 2000, type: 'error' })
            }
            this.dialogLoading = false
          }).catch(err => {
            this.$message({ message: err.msg, duration: 2000, type: 'error' })
            this.dialogLoading = false
          })
        } else {
          console.log('error submit!!')
          return false
        }
      })
    }
  }
}
</script>

<style lang="scss">
.coach-edit {
  padding: 0px 0 60px !important;
  height: auto !important;
  position: relative;
  .btn-list {
    float: right;
    margin-right: 10px;
    font-size: 12px;
    color: #409EFF;
    cursor: pointer;
  }
  .el-card__header,
  .el-card__body {
    padding: 15px;
  }
  .fix-lh {
    line-height: 32px;
  }
  .el-input.is-disabled .el-input__inner {
    color: #606266;
  }
  .left{
    min-height:500px;
    background:#fff;
  }
  .left-tree{
    width: 100%;
    min-height:600px;
    overflow: auto;
  }
  .left-top{
    width: 100%;
    height: 40px;
    text-align: center;
    line-height: 40px;
    font-size: 16px;
    color: #333;
    background: #e2e2e2;
    font-size: 15px;
  }
  .box-card{
    margin-bottom: 10px;
  }
  .avtar-wrap{
    padding: 10px 30px 30px;
    .avtar-item{
      width: 158px;
      margin: 0 auto 50px;
      p{
        line-height: 26px;
        color: #bbb;
      }
      .avtar-img{
        width: 158px;
        height: 158px;
      }
      .avtar-tip{
        color: #555;
      }
    }
  }

  .avatar-uploader {
    .el-upload{
      // display: flex;
    }
    .avatar-uploader-icon {
      font-size: 28px;
      color: #8c939d;
      width: 148px;
      height: 148px;
      line-height: 148px;
      text-align: center;
      border: 1px dashed #d9d9d9;
      border-radius: 6px;
      cursor: pointer;
      position: relative;
      overflow: hidden;
    }
    .avatar-uploader-icon:hover{
      border-color: #409EFF;
    }
    .fix-upload .avatar-uploader-icon{
      border: none;
    }
    .list-upload-image{
      // max-width: 800px;
      overflow: hidden;
      li{
        width: 148px;
        height: 148px;
        line-height: 148px;
        display: inline-block;
        margin: 0 5px 5px;
        border: 1px dashed #d9d9d9;
        float: left;
        position: relative;
        .image-item{
          // width: 100%;
          // height: 100%;
          max-width: 100%;
          max-height: 100%;
          vertical-align: middle;
        }
        .icon-close{
          position: absolute;
          right: 0px;
          top: 0px;
          color: red;
          font-size: 18px;
        }
        .course-name{
          position: absolute;
          left: 0px;
          bottom: 0px;
          font-size: 12px;
          width: 100%;
          height: 25px;
          line-height: 25px;
          text-align: center;
          overflow: hidden;
          display: inline-block;
          background:rgba(0, 0, 0, 0.3);
          color: #fff;
        }
      }
    }
    .course-state1{
      position: absolute;
      left: 3px;
      top: 3px;
      display: inline-block;
      width: 50px;
      height: 20px;
      line-height: 20px;
      text-align: center;
      border-radius: 10px;
      background: #02830f;
      color: #fff;
    }
    .course-state2{
      position: absolute;
      left: 3px;
      top: 3px;
      display: inline-block;
      width: 50px;
      height: 20px;
      line-height: 20px;
      text-align: center;
      border-radius: 10px;
      background: #ec808d;
      color: #fff;
    }
  }
  .edit-footer{
    width: calc(100% - 248px);
    height: 60px;
    line-height: 60px;
    position: fixed;
    background: #fff;
    left: 230px;
    bottom: 0;
    padding-left: 20px;
    box-sizing: border-box;
  }
  #addressMap{
    width: 100%;
    height: 300px;
  }
  .fix-address{
    margin-bottom: 0px !important;
  }
}
</style>
